{if $action != 'input'}{template common/header}
<div id="content">
<div class="pageheader">
	<div class="right">
		<ul class="tabs">
			<!--{if $action == 'pre' || !$action}--><li class="active"><!--{else}--><li><!--{/if}-->
				<a href="{URL}?mod=adv&fun=index&action=pre&token={$token}">预订</a>
			</li>
			<!--{if $action == 'view'}--><li class="active"><!--{else}--><li><!--{/if}-->
				<a href="{URL}?mod=adv&fun=index&action=view&token={$token}">查看全部</a>
			</li>
			{if $_G['adminid']}
			<!--{if $action == 'admin'}--><li class="active"><!--{else}--><li><!--{/if}-->
				<a href="{URL}?mod=adv&fun=index&action=admin&token={$token}">管理操作</a>
			</li>
			{/if}
		</ul>
	</div>
</div>
<div class="clear"></div>
{if $returnsign}
<div class="sign">{$returnsign}</div>
{/if}
<script>
var tl;
 function onLoad() {
	var eventSource = new Timeline.DefaultEventSource();
	var theme = Timeline.ClassicTheme.create(); // create the theme
            theme.event.bubble.width = 350;   // modify it
            theme.event.bubble.height = 300;
            theme.event.track.height = 15;
            theme.event.tape.height = {if $step == '2'}18{else}5{/if};
			theme.event.duration.color = '#FF5F83';
   var bandInfos = [
     Timeline.createBandInfo({
		 overview:       true,
		 theme:          theme,
		 eventSource:    eventSource,
         width:          "{if $step == '2'}20%{else}10%{/if}", 
         intervalUnit:   Timeline.DateTime.MONTH, 
         intervalPixels: 200
     }),
	 Timeline.createBandInfo({
		 eventSource:    eventSource,
		 theme:          theme,
/* 
		 设定目前时间 */
         //date:           "Wed May 01 2011 00:00:00 GMT-0600",
         width:          "{if $step == '2'}80%{else}90%{/if}", 
         intervalUnit:   Timeline.DateTime.WEEK, 
         intervalPixels: 100
     })
   ];
   /* 控制同步 */
   bandInfos[1].syncWith = 0;
   bandInfos[1].highlight = true;
   tl = Timeline.create(document.getElementById("my-timeline"), bandInfos);
   Timeline.loadXML("{URL}/?mod=adv&fun=index&do=xml&advid={$advid}&token={$token}", function(xml, url) { eventSource.loadXML(xml, url); });

 }

 var resizeTimerID = null;
 function onResize() {
     if (resizeTimerID == null) {
         resizeTimerID = window.setTimeout(function() {
             resizeTimerID = null;
             tl.layout();
         }, 500);
     }
 }
</script>
{/if}
{if $action == 'pre' || !$action}
{if $step == 1 || !$step}
<h2>选择广告位</h2>
<div class="advcont">
	<div class="sign">您可以首先在“查看全部”里查看所有广告位的安排情况。在这个页面，左侧粉色区域可以点击，对应的是右侧图片所示位置。点击之后可以进入预定页面。填写您的广告位信息提交，完成预定。付款后您的广告位被确定，就能在内页的时间段内显示了。TIPS：您选择的时间段不能和已经定制了的区域重合。</div>
	<div class="advmap left">
		<h3>首页右侧边栏</h3>
		<a href="javascript:;"><div class="adv1">首页大图广告位(此广告位不可预订)</div></a>
		<a href="?mod=adv&fun=index&action=pre&step=2&advid=2&token={$token}"><div class="adv2">首页小图广告位2</div></a>
		<a href="?mod=adv&fun=index&action=pre&step=2&advid=3&token={$token}"><div class="adv2">首页小图广告位3</div></a>
		<a href="?mod=adv&fun=index&action=pre&step=2&advid=4&token={$token}"><div class="adv2">首页小图广告位4</div></a>
		<a href="?mod=adv&fun=index&action=pre&step=2&advid=5&token={$token}"><div class="adv2">首页小图广告位5</div></a>
		<a href="?mod=adv&fun=index&action=pre&step=2&advid=6&token={$token}"><div class="adv2">首页小图广告位6</div></a>
		<a href="?mod=adv&fun=index&action=pre&step=2&advid=7&token={$token}"><div class="adv2">首页小图广告位7</div></a>
		<a href="?mod=adv&fun=index&action=pre&step=2&advid=8&token={$token}"><div class="adv2">首页小图广告位8</div></a>
		<a href="?mod=adv&fun=index&action=pre&step=2&advid=9&token={$token}"><div class="adv2">首页小图广告位9</div></a>
	</div>
	<div clss="right">
		<img src="{URL}/app/adv/static/image/topitad.jpg" alt="ad" width="300px" height="448px"/>
	</div>
</div>
{elseif $step == 2}
<h2>广告位{$advid}预订状态</h2>
<div id="my-timeline" style="height: 300px; margin: 20px 0;border: 1px solid #aaa"></div>
<noscript>
您的浏览器不支持javascript! 
</noscript>
<h2>预订广告位{$advid}</h2>
<iframe frameborder=0 width=600 height=340 marginheight=0 marginwidth=0 scrolling=no src="?mod=adv&fun=index&action=input&advid={$advid}&token={$token}"></iframe>
{/if}
{elseif $action == 'view'}
<h2>查看目前所有广告位预订状态</h2>
<div id="my-timeline" style="height: 500px; margin: 20px 0;border: 1px solid #aaa"></div>
<noscript>
您的浏览器不支持javascript! 
</noscript>
{elseif $action == 'input'}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>提交</title>
{csstemplate}
<link rel="stylesheet" type="text/css" media="all" href="{URL}/app/{CURMODULE}/static/js/date/jsDatePick_ltr.css" />
{jstemplate}
<script type="text/javascript" src="{URL}/app/{CURMODULE}/static/js/date/jsDatePick.full.1.3.js"></script>
<script type="text/javascript" src="{URL}/static/js/upload/swfupload.js"></script>
<script type="text/javascript" src="{URL}/static/js/upload/plugins/swfupload.queue.js"></script>
<script type="text/javascript" src="{URL}/static/js/upload/plugins/fileprogress.js"></script>
<script type="text/javascript" src="{URL}/app/adv/static/js/upload/handlers.js"></script>
<script type="text/javascript">
var swfu;
var root = "{URL}";
window.onload = function() {
	new JsDatePick({
		limitToToday:true,
		dateFormat:"%n-%j-%Y",
		useMode:2,
		target:"starttime"
	});
	var settings = {
		flash_url : "{URL}/static/js/upload/Flash/swfupload.swf",
		upload_url: "{URL}/ajax.php",
		post_params: {"advid" : "{$advid}"},
		file_size_limit : "100 MB",
		file_types : "*.jpg;*.jpeg;*.gif;*.png",
		file_types_description : "All Files",
		file_upload_limit : 100,
		file_queue_limit : 0,
		custom_settings : {
			progressTarget : "fsUploadProgress",
			cancelButtonId : "btnCancel"
		},
		debug: false,

		// Button settings
		button_image_url: "./static/image/common/upBtn.gif",
		button_width: "75",
		button_height: "29",
		button_placeholder_id: "spanButtonPlaceHolder",
		button_text: '<span class="theFont">点击上传</span>',
		button_text_style: ".theFont {  color:#ffffff;font-size:13px;font-weight:bold;}",
		button_text_left_padding: 12,
		button_text_top_padding: 3,
		
		// The event handler functions are defined in handlers.js
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
		queue_complete_handler : queueComplete	// Queue plugin event
	};

	swfu = new SWFUpload(settings);
 };
</script>
</head>
<body>
{if $returnsign}
<div class="sign">{$returnsign}</div>
{/if}
{if $isok == 1}
<a href="$_SERVER['HTTP_REFERER']">点击返回</a>
{else}
<div class="sign">如果您没有图片链接，请在提交信息之前提交上传图片，广告位1为213*213，其余为213*80，超过部分会被裁剪</div>
<div class="fieldset flash sign" id="fsUploadProgress">上传信息状态栏</div>
<div class="form">
	<form action="" method="post">
		<input type="hidden" name="formhash" value="{FORMHASH}" />
		<input type="hidden" name="token" value="{$token}" />
		<input type="hidden" name="advid" value="{$advid}" />
		<p>
			<label>开始时间:</label>
			<input type="text" id="starttime" name="starttime" value="{eval echo @$_POST['starttime']}" />*(默认时间段为30天)
		</p>
		<!--<p>
			<label>结束时间:</label>
			<input type="text" id="endtime" name="endtime" value="{eval echo @$_POST['endtime']}" />
		</p>-->
		<p>
			<label>标题:</label>
			<input type="text" id="title" name="title" value="{eval echo @$_POST['title']}" />*
		</p>
		<p>
			<label>链接:</label>
			<input type="text" id="link" name="link" value="{eval echo @$_POST['link']}" />*
		</p>
		<p>
			<label>图片:</label>
			<input type="text" id="image" name="image" value="{eval echo @$_POST['image']}" />*(可以填写绝对地址或者点击上传图片)<br />
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<span id="spanButtonPlaceHolder"></span>
			<input id="btnCancel" type="button" value="取消" onclick="swfu.cancelQueue();" disabled="disabled" style="width:40px;" />
		</p>
		<p>
			<label>联系方式:</label>
			<input type="text" id="tel" name="tel" value="{eval echo @$_POST['tel']}" />
		</p>
		<p>
			<input type="submit" name="submit" class="subbox" value="提交" />
		</p>
	</form>
</div>
{/if}
</body>
</html>
{elseif $action='admin'}
<form action="" method="post">
	<table class="olt" style="clear:both">
		<tbody>
			<tr>
				<td class="pl" align="center" style="width:40px;">选择</td>
				<td class="pl" style="width:112px;"><span class="mail_from">广告位</span></td>
				<td width="20"></td>
				<td class="pl">可用</td>
				<td class="pl">标题</td>
				<td class="pl" style="width:160px;">起始时间</td>
				<td class="pl" style="width:160px;">结束时间</td>
			</tr>
			{loop $ls $key $value}
			<tr id="{$value[advid]}">
				<td align="center"><input name="advid[]" type="checkbox" value="{$value[advid]}"></td>
				<td><div class="mail_from">{$value[type]}</div></td>
				<td></td>
				<td>{if $value[available]}<font color="#FF5F83">可用</font>{else}预订{/if}</td>
				<td>{$value[title]}</td>
				<td>{eval echo dgmdate($value[starttime])}</td>
				<td>{eval echo dgmdate($value[endtime])}</td>
			</tr>
			{/loop}
			<tr>
				<td align="left" colspan="7"><!--
					<input class="subbox" name="b" type="button" value="全选" onclick="CheckAll(true);"> &nbsp; 
					<input class="subbox" name="c" type="button" value="全清" onclick="CheckAll(false);">&nbsp;-->
					<input class="subbox" name="mc_delete" type="submit" value="删除选中">
					<input class="subbox" name="mc_right" type="submit" value="通过选中">
				</td>
			</tr>
		</tbody>
	</table>
</form>
{/if}
</div>
{if $action != 'input'}{template common/footer}{/if}